<style xmlns="http://www.w3.org/1999/html">
    /*分页*/
    .pagination {
    }

    .pagination li {
        display: inline-block;
        margin-right: -1px;
        padding: 5px 10px;
        margin:  0 2px;
        border: 1px solid #ddd;
        min-width: 20px;
        text-align: center;
        vertical-align: top;
        border-radius: 5px;

    }
    .pagination li:nth-of-type(1){
        padding: 4px 10px;
    }
    .pagination li.active {
        background: #009688;
        color: #fff;
        border: 1px solid #00a29a;
        padding: 3px 10px;
    }

    .pagination li a {
        display: block;
        text-align: center;
        color: #999;
    }
</style>
<div class="index_html huanzheliebiao flex_sign">

    <div class="list_box">
        <div class="title">
            <p>患者列表</p>
        </div>
        <div class="top">

            <form action="{:url('patient/index')}" method="get" >

                <!-- 开始日期 -->
                <div class="start_date">
                    <script type="text/javascript">
                        $(function () {
                            $('.end_date_picker').date_input();
                        })
                    </script>
                    <div style="">
                        <input style="border: 1px solid #bbb;font-size: 14px;color: #333;padding: 7px;border-radius: 3px;"
                               type="text" class="end_date_picker" value="" id="start_date">
                    </div>
                    <script>
                        //创建一个当前日期对象
                        var now = new Date();
                        //格式化日，如果小于9，前面补0
                        var day = ("0" + now.getDate()).slice(-2);
                        //格式化月，如果小于9，前面补0
                        var month = ("0" + (now.getMonth() + 1)).slice(-2);
                        //拼装完整日期格式
                        var today = now.getFullYear() + "-" + (month) + "-" + (day);
                        //完成赋值
                        $('#start_date').val(today);
                    </script>
                </div>
                <!-- 下面截止日期 -->
                <div class="end_date">
                    <script type="text/javascript">
                        $(function () {
                            $('.date_picker').date_input();
                        })
                    </script>
                    <div style=" margin:50px auto; width:500px;">
                        <input style="width:226px;background: #fefefe;border: 1px solid #bbb;font-size: 14px;color: #333;padding: 7px;border-radius: 3px;"
                               type="text" class="date_picker" value="" id="end_date">
                    </div>
                    <script>
                        //创建一个当前日期对象
                        var now = new Date();
                        //格式化日，如果小于9，前面补0
                        var day = ("0" + now.getDate()).slice(-2);
                        //格式化月，如果小于9，前面补0
                        var month = ("0" + (now.getMonth() + 1)).slice(-2);
                        //拼装完整日期格式
                        var today = now.getFullYear() + "-" + (month) + "-" + (day);
                        //完成赋值
                        $('#end_date').val(today);
                    </script>
                </div>
                <!-- 下面是身份证 -->
                <div class="id_card">
                    <input type="text" placeholder="查找姓名或者身份证号"><button type="submit" value="搜索" class="sou_btn"></button>
                </div>
            </form>
            <!-- 下面是搜索  -->
            <div class="new_box">
                <a href="xinjianhuanzhe.html">
                    <i><img src="__STATIC__/index/imgs/new_btn.png" alt=""></i>
                    <span>新建患者</span>
                </a>
            </div>


        </div>
        <!--  列表的开始 -->
        <div class="list">
            <div class="top_dec">
                <strong>姓名</strong>
                <strong>性别</strong>
                <strong>身份证号</strong>
                <strong>年龄</strong>
                <strong>检查记录</strong>
                <strong>检查时间</strong>
            </div>
            <ul>
                {foreach $list as $patient}
                <li>
                    <a href="huanzhexinxi.html">
							<span class="first">
								<em>{$patient.name}</em>
							</span>
                        <span>{$patient['sex']|get_sex_str}</span>
                        <span>{$patient.document_num}</span>
                        <span>{$patient['birth']|getAge}岁</span>
                        <span>共8条检查记录</span>
                        <span>2012-05-28</span>
                    </a>
                </li>

                {/foreach}

            </ul>
        </div>
        <!--  列表的结束 -->
        <div class="page_btn">
            <div class="center">


                <span class="decration">共{$list->lastPage()}页/ {$list->total()}条数据</span>
                <!--{$list->render()}-->
                <!--<div class="mid">-->
                <!--<em class="page_up"></em>-->
                <!--<span class="first_span">1</span>-->
                <!--<span>2</span>-->
                <!--<span>3</span>-->
                <!--<span>···</span>-->
                <!--<em class="page_down"></em>-->
                <!--</div>-->
                &nbsp;&nbsp;&nbsp;&nbsp;
                <!-- <input name="name" class="form-control" value="{$name}" placeholder="标题"> -->

                <div class="form-group">
                    {$list->render()}
                </div>
                <strong class="to_new">
                    跳至
                    <input type="hidden" value="">
                    <input type="text" min="1" max="{$list->total()}" id="turnpage" name="turnpage" value="">
                    <!-- <input type="button"> -->
                    页<input type="button" id="page-num" onclick="getInputPage()" class="btn btn-danger" value="跳转">
                </strong>


                <!--</form>-->

            </div>
        </div>
    </div>
</div>

<script>

    function changeURLArg(url, arg, arg_val) {
        var pattern = arg + '=([^&]*)';
        var replaceText = arg + '=' + arg_val;
        if (url.match(pattern)) {
            var tmp = '/(' + arg + '=)([^&]*)/gi';
            tmp = url.replace(eval(tmp), replaceText);
            return tmp;
        } else {
            if (url.match('[\?]')) {
                return url + '&' + replaceText;
            } else {
                return url + '?' + replaceText;
            }
        }
        return url + '\n' + arg + '\n' + arg_val;
    }
    var url = '{$url}';
    function getInputPage() {
        var page = $("#turnpage").val();
        var page_url = changeURLArg(url, 'page', page);

        location.href = page_url;
    }

</script>